<!--ljx 2022.9.1 测试页面  -->
<template>
  <view style="display: flex; flex-wrap: wrap">
    <view class="machine-list-card" :key="item.id" v-for="item in myGoodsList">
      <good
        :img="item.img"
        :describe="item.describe"
        :title="item.title"
        :price="item.price"
        :num="item.num"
        :id="item.id"
        ><img src="/cart.png" style="width: 46px; height: 36px"
      /></good>
    </view>
  </view>
</template>

<script setup>
import { useStore } from "vuex";
import good from "./good.vue";
import { compile, computed, inject, ref } from "vue";
const store=useStore()
//在此注入父组件index.vue中的provide的值myGoodsList
// const myGoodsList = inject("myGoodsList");
const myGoodsList =ref(store.getters.getMyGoodsList)

// data() {
//   //这里存放数据
//   return {
//     msg: "测试数据",
//   };
// },
//import引入的组件需要注入到对象中才能使用
// components: {
//   good,
// },
//监听属性 类似于data概念
</script>

<style scoped>
.machine-list-card {
  width: 350px;
  height: 200px;
  /* margin: 5px auto; */
  display: flex;
  flex-direction: row;
  background-color: #ffffff;
  border-radius: 10px;
  box-shadow: 5px 5px 10px rgba(160, 160, 160, 0.3);
  margin-bottom: 10px;
  margin-right: 10px;
}

.left {
  width: 180px;
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.right {
  width: 200px;
  height: 200px;
  padding: 20px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}

.img {
  width: 170px;
  height: 170px;
}

.img image {
  width: 170px;
  height: 170px;
}

.info-item {
  display: flex;
  white-space: nowrap;
}

.info-item-title {
  /* font-weight: bold; */
  font-size: 20px;
  width: 4em;
  text-align: justify;
  text-align-last: justify;
}

.info-item-content {
  margin-left: 10px;
  overflow: hidden;
}
</style>
